<template>
  <el-row>
  <el-col :span="6">
    <div class="grid-content bg-purple">
      <el-input
        placeholder="请输入内容"
        v-model="input"
        class="inputs"
      >
      </el-input>
      <el-button type="primary" class="search" @click="sendDataToParent(true)">搜索</el-button>
    </div>
  </el-col>
  <el-col :span="6">
    <div class="grid-content bg-purple-light" v-if="show==0?true:false">
       <el-select v-model="value" placeholder="请选择">
        <el-option
          v-for="item in allType"
          :key="item.typeId"
          :label="item.typeName"
          :value="item.typeName"
        >
        </el-option>
      </el-select>
      <el-button type="primary" class="search" @click="sendDataToParent(false)">查找</el-button>
    </div>
  </el-col>
  <el-col :span="12" align="right">
    <div class="grid-content bg-purple add" v-if="flag==0?true:false">
      <el-button type="success" @click="openAddDialog" v-if="show==0?true:false">添加</el-button>
      <el-button type="danger" @click="cancellation">批量注销</el-button>
    </div>
  </el-col>
</el-row>
</template>

<script>

export default{
    name:'SearchAdd',
    props:['openAddDialog','cancellation','flag','allType','show'],
    data(){
      return {
        input:'',
        value: '',
      }
    },
    methods:{
      sendDataToParent(o) {
        this.$emit('send-data',this.input,this.value,o);
      },
    },
  }

</script>

<style scoped>
  .search{
    margin-left: 10px;
    position: fixed;
  }
  .inputs{
    width: 200px;
  }
  .add{
    width: 180px;
  }
</style>